Kickle Cubicle Password Generator
by: TFG (palacios_barreda@yahoo.com.mx)
---------------------------------

After my first successful attempt to make a password generator (Adventures of Lolo) I decided to try a
more difficult game. I chose Kickle Cubicle because I had to settle the score from back then when I had 
to turn that game down (by the time I attemped to make a Level editor, which I'm about to retry).

I'm not going to post here all the code used by the game to Verify/Decode/Generate passwords. It's a lot.
Instead, you can have my notes on that project. (Included in the source code of the password generator).

[Password Generation Algorithm]

PwdMask: Array[0..7] of Byte = ($01, $16, $13, $05, $10, $02, $17, $04);

// Encrypt the unused byte (used in the japanese version though)
Unused := Unused shl 2;
Encrypt(Unused, 5, 0, 6, Pass);

// Encrypt the Zone
Zone := Zone shl 5;
Encrypt(Zone, 4, 1, 3, Pass);

// Encrypt the Level
Level := Level shl 2;
Encrypt(Level, 1, 1, 6, Pass);

for i := 0 to 3 do begin
    Pass[i + 1] := Pass[i] xor Pass[i + 1];
end;

// Control Code #1
Pass[4] := Pass[0] xor Pass[1] xor Pass[2] xor Pass[3];

// Control Code #2 & #3
Pass[6] := ((Pass[0] + Pass[1] + Pass[2] + Pass[3]) shr 5);
Pass[5] := ((Pass[0] + Pass[1] + Pass[2] + Pass[3]) and $1F);

// Control Code #4
i := Pass[5];
while(i >= 0) do Dec(i, 7);
Inc(i, 7);
Pass[7] := (Pass[i] xor $1F);

// Mask the password
MaskPassword(Pass);

// Convert to ASCII
KCtoASCII(Pass);
_________________________________________________________________________

Three functions are used in this routine:

	1) Encrypt: a set of Shifts n' Rolls based on a few given parameters (check the source)
	2) MaskPassword: just a routine that adds the mask with certain bytes of the password.
	3) KCtoASCII: to make the password readable.

Have fun,
TFG.

EOF.	